#!/bin/sh /etc/rc.common
# Freifunk Init
# $Id: freifunk 4608 2009-05-25 14:01:31Z jow $

START=99

boot() {
	test -f /etc/crontabs/root || touch /etc/crontabs/root

	grep -q 'killall -HUP dnsmasq' /etc/crontabs/root || {
		echo "*/5 * * * *	killall -HUP dnsmasq" >> /etc/crontabs/root
	}

	grep -q '/usr/sbin/ff_olsr_test_gw' /etc/crontabs/root || {
		echo "* * * * *		/usr/sbin/ff_olsr_test_gw" >> /etc/crontabs/root
	}

	grep -q '/usr/sbin/ff_olsr_watchdog' /etc/crontabs/root || {
		echo "*/5 * * * *	/usr/sbin/ff_olsr_watchdog" >> /etc/crontabs/root
	}

	grep -q '/usr/sbin/ff_rdate' /etc/crontabs/root || {
		echo "0 */4 * * *	/usr/sbin/ff_rdate" >> /etc/crontabs/root
	}

	grep -q '/usr/sbin/ff_mapupdate' /etc/crontabs/root || {
		echo "17 * * * *	/usr/sbin/ff_mapupdate" >> /etc/crontabs/root
	}

	[ -f /etc/rc.local ] && . /etc/rc.local
	[ -d /etc/rc.local.d ] && {
		for file in /etc/rc.local.d/*; do
			test -f "$file" && . "$file"
		done
	}

	( /usr/sbin/ff_rdate; /etc/init.d/cron restart ) &
}
